﻿using IterationLife.Domains.Sports.Models;
using IterationLife.Domains.Sports.Repositories;
using Util.Datas.Ef;

namespace IterationLife.Datas.Repositories.Sports
{
    /// <summary>
    /// 运动员仓储
    /// </summary>
    public class SportAthleteRepository : RepositoryBase<SportAthlete>, ISportAthleteRepository
    {
        /// <summary>
        /// 初始化运动员仓储
        /// </summary>
        /// <param name="unitOfWork">工作单元</param>
        public SportAthleteRepository(IApplicationUnitOfWork unitOfWork) : base(unitOfWork)
        {
        }

        /// <summary>
        /// 是否存在
        /// </summary>
        public bool IsPersonExist(int personId)
        {
            var partnerAthleteId = personId.ToString();
            return Exists(t => t.PartnerAthleteId == partnerAthleteId);
        }
    }
}
